from selenium import webdriver
#from selenium.webdriver.support.select import Select
import time
import xlrd
from datetime import date,datetime
# from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.touch_actions import TouchActions

browser = webdriver.Chrome()
browser.get("http://10.22.26.74:8080/dist/index.html#/")
browser.maximize_window()
time.sleep(1)
browser.find_element_by_id("username").send_keys("tracy.wang")
time.sleep(1)
browser.find_element_by_id("password").send_keys("123456")
time.sleep(1)
browser.find_element_by_class_name("login-btn").click()
time.sleep(2)
# 点击其他系统
browser.find_element_by_xpath("//*[@id='app']/div/div[2]/div[1]/div/div/ul/li[4]/div/div/span").click()


class excel_action():
    # 获取单个值
    def read_excel_values(self,address,sheet,row,col):  #获取单个值
        row=row-1
        col=col-1
        self.excel=xlrd.open_workbook(address)
        self.table=self.excel.sheets()[sheet]
        excel_values=self.table.row_values(row)[col]  #row 行号，col 列
        return excel_values

    # 读取一行的值
    def read_excel_row(self,address,sheet,row):
        self.excel = xlrd.open_workbook(address)
        self.table = self.excel.sheets()[sheet]
        table_values_row = self.table.row_values(row)
        return table_values_row

    # 读取一列的值
    def read_excel_col(self,address,sheet,col):
        col = col-1
        self.excel = xlrd.open_workbook(address)
        self.table = self.excel.sheets()[sheet]
        table_values_col = self.table.col_values(col)
        return table_values_col

filename ='D:/autoproject/venv/Include/保单信息.xlsx'
excelread = xlrd.open_workbook(filename)
table = excelread.sheet_by_name('Sheet1')
h = table.nrows
print(h)

for i in range(2,h):
    excel = excel_action()
    list_login = excel.read_excel_row(filename, 0,i)  # read excel data
    print(list_login)
    #点击纸质交单
    time.sleep(2)
    browser.find_element_by_xpath("//*[@id='app']/div/div[2]/div[1]/div/div/ul/li[4]/ul/li/ul/li[3]/div").click()
    # 切换到当前窗口
    windows = browser.window_handles
    browser.switch_to.window(windows[-1])
    time.sleep(3)
    browser.find_element_by_xpath("//*[@id='app']/div/div/div[1]/div/div[1]/input").click()
    time.sleep(1)
    browser.find_element_by_xpath("/html/body/div[2]/div[1]/div[1]/ul/li[3]").click()
    browser.find_element_by_xpath("//*[@id='app']/div/div/div[2]/button").click()
    time.sleep(1)
    aa = browser.find_element_by_xpath("//*[@id='app']/div/span[1]").text
    print(aa)
    browser.close()
    # 切换到最新的窗口
    windows = browser.window_handles
    browser.switch_to.window(windows[-1])
    # 点击纸质单录单
    browser.find_element_by_xpath("//*[@id='app']/div/div[2]/div[1]/div/div/ul/li[1]/ul/li/ul/li[11]/div").click()
    time.sleep(1)
    browser.find_element_by_class_name("el-input__inner").send_keys(aa)
    #获取任务
    time.sleep(2)
    ele1 = browser.find_element_by_css_selector(".el-button.el-btn-style3.el-button--primary")
    print(ele1)
    ele1.click()
    time.sleep(3)
    browser.find_element_by_xpath("/html/body/div[2]/div/div[3]/button/span").click()
    time.sleep(5)
    browser.find_element_by_xpath("//*[@id='curLeftBox']/div/div[2]/div[2]/div/div[1]/div[3]/table/tbody/tr[1]/td[1]/div/span").click()
    time.sleep(2)
    windows = browser.window_handles
    browser.switch_to.window(windows[-1])
    time.sleep(1)
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[1]/div[1]/div/div[2]/span/div[2]/input").send_keys(list_login[0])
    time.sleep(1)
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[1]/div[2]/div/div[2]/span/div[2]/div[1]/input").click()
    time.sleep(1)
    browser.find_element_by_xpath( '/html/body/div[2]/div[1]/div[1]/ul/li['+ str(list_login[1]) +']').click()
    time.sleep(1)
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[1]/div[3]/div/div[2]/span/div[2]/div/input").click()
    time.sleep(1)
    browser.find_element_by_xpath( "/html/body/div[3]/div[1]/div[1]/ul/li['+ int(list_login[2]) +']").click()
    time.sleep(1)
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[1]/div[4]/div/div[2]/span/div[2]/div/input").click()
    time.sleep(1)
    browser.find_element_by_xpath("/html/body/div[4]/div[1]/div[1]/ul/li['+ int(list_login[3]) +']").click()
    time.sleep(1)
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[2]/div[1]/div/div[2]/div/span/div[2]/input").send_keys(list_login[4])
    #证件类型
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[2]/div[2]/div/div[2]/span/div[2]/div/input").click()
    time.sleep(1)
    browser.find_element_by_xpath("/html/body/div[6]/div[1]/div[1]/ul/li['+ int(list_login[5]) +']").click()
    #证件号码
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[2]/div[3]/div/div[2]/span/div[2]/input").send_keys(list_login[6])
    #证件有效期
    print(list_login[7])
    carddate = list_login[7]

    if carddate == "长期":
        browser.find_element_by_xpath\
            ("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[2]/div[4]/div/div[2]/div[1]/label[1]/span[1]/span").click()
    else:
        browser.find_element_by_xpath\
            ("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[2]/div[4]/div/div[2]/div/label[2]/span[1]/span").click()
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[2]/div[4]/div/div[2]/span/div[2]/input").send_keys(list_login[7])
     # 联系电话
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[3]/div[1]/div/div[2]/span/div[2]/input").send_keys(int(list_login[8]))
    #邮箱
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[3]/div[2]/div/div[2]/span/div[2]/input").send_keys(list_login[9])

    #居住地区
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[4]/div[1]/div/div[2]/span[1]/span/span/span").click()
    print(int(list_login[10]))
    list_login[10]=int(list_login[10])
    time.sleep(1)
    browser.find_element_by_xpath('/html/body/div[8]/ul[1]/li['+ str(list_login[10]) +']').click()
    time.sleep(1)
    browser.find_element_by_xpath('/html/body/div[8]/ul[2]/li['+ str(list_login[11]) +']').click()
    time.sleep(1)
    browser.find_element_by_xpath('/html/body/div[8]/ul[3]/li['+ str(list_login[12]) +']').click()

    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[4]/div[1]/div/div[2]/span[2]/div[2]/input").send_keys(list_login[13])
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[4]/div[1]/div/div[2]/span[3]/div[2]/input").send_keys(int(list_login[14]))

    #工作单位地址
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[4]/div[2]/div/div[2]/span/span/span").click()
    time.sleep(1)
    browser.find_element_by_xpath('/html/body/div[9]/ul[1]/li['+ str(list_login[15]) +']').click()
    time.sleep(1)
    browser.find_element_by_xpath('/html/body/div[9]/ul[2]/li['+ str(list_login[16]) +']').click()
    time.sleep(1)
    browser.find_element_by_xpath('/html/body/div[9]/ul[3]/li['+ str(list_login[17]) +']').click()

    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[4]/div[2]/div/div[2]/div[1]/input").send_keys(list_login[18])
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[4]/div[2]/div/div[2]/div[2]/input").send_keys(int(list_login[19]))
    #职业名称
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[5]/div[2]/div/div[2]/span/div[2]/div/input").send_keys(list_login[20])
    time.sleep(1)
    browser.find_element_by_xpath("/html/body/div[10]/div[1]/div[1]/ul/li/span").click()
    #年收入
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[5]/div[4]/div/div[2]/span/div/input").send_keys(int(list_login[21]))
    #家庭年收入
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[6]/div[4]/div/div[2]/span/div[2]/input").send_keys(int(list_login[22]))

    # 学历
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[7]/div[1]/div/div[2]/span/div[2]/div/input").click()
    time.sleep(1)
    #browser.find_element_by_xpath("/html/body/div[2]/div[1]/div[1]/ul/li[4]").click()
    if list_login[23] == "博士":
        browser.find_element_by_xpath("/html/body/div[11]/div[1]/div[1]/ul/li[1]").click()
    elif list_login[23] == "硕士":
        browser.find_element_by_xpath("/html/body/div[11]/div[1]/div[1]/ul/li[2]").click()
    elif list_login[23] == "本科":
        browser.find_element_by_xpath("/html/body/div[11]/div[1]/div[1]/ul/li[3]").click()
    elif list_login[23] == "大专":
        browser.find_element_by_xpath("/html/body/div[11]/div[1]/div[1]/ul/li[4]").click()
    elif list_login[23] == "中专":
        browser.find_element_by_xpath("/html/body/div[11]/div[1]/div[1]/ul/li[5]").click()
    elif list_login[23] == "中技":
        browser.find_element_by_xpath("/html/body/div[11]/div[1]/div[1]/ul/li[6]").click()
    elif list_login[23] == "初中":
        browser.find_element_by_xpath("/html/body/div[11]/div[1]/div[1]/ul/li[7]").click()
    elif list_login[23] == "小学":
        browser.find_element_by_xpath("/html/body/div[11]/div[1]/div[1]/ul/li[8]").click()
    else:
        browser.find_element_by_xpath("/html/body/div[11]/div[1]/div[1]/ul/li[9]").click()
    # 单位名称
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div/div/div[2]/div[7]/div[2]/div/div[2]/span/div[2]/input").send_keys(list_login[24])
    #投保人信息函数

    def insured_person():
        #姓名
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[1]/div[1]/div/div[2]/span/div[2]/input").send_keys(list_login[27])
        #性别
        browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[1]/div[2]/div/div[2]/span/div[2]/div/input").click()
        time.sleep(1)
        print(list_login[28])
        if list_login[28] == '女':
            browser.find_element_by_xpath("/html/body/div[12]/div[1]/div[1]/ul/li[1]/span").click()
        else:
            browser.find_element_by_xpath("/html/body/div[12]/div[1]/div[1]/ul/li[2]/span").click()
        #婚姻状态
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[1]/div[3]/div/div[2]/span/div[2]/div/input").click()
        time.sleep(1)
        if list_login[29] == '未婚':
            browser.find_element_by_xpath("/html/body/div[13]/div[1]/div[1]/ul/li[1]/span").click()
        else:
            browser.find_element_by_xpath("/html/body/div[13]/div[1]/div[1]/ul/li[2]/span").click()
        #国籍
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[1]/div[4]/div/div[2]/span/div[2]/div/input").click()
        time.sleep(1)
        browser.find_element_by_xpath('/html/body/div[14]/div[1]/div[1]/ul/li['+ str(list_login[30])+']').click()
        #出生日期
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[2]/div[1]/div/div[2]/div/span/div[2]/input").send_keys(list_login[31])
        #证件类型
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[2]/div[2]/div/div[2]/span/div[2]/div/input").click()
        time.sleep(1)
        if list_login[32] == "居民身份证":
            browser.find_element_by_xpath(
                "/html/body/div[16]/div[1]/div[1]/ul/li[1]/span").click()
        elif list_login[32] == "户口簿":
            browser.find_element_by_xpath(
                "/html/body/div[16]/div[1]/div[1]/ul/li[2]/span").click()
        elif list_login[32] == "中国人民解放军军官证":
            browser.find_element_by_xpath(
                "/html/body/div[16]/div[1]/div[1]/ul/li[3]/span").click()
        elif list_login[32] == "出生医学证明":
            browser.find_element_by_xpath(
                "/html/body/div[16]/div[1]/div[1]/ul/li[4]/span").click()
        elif list_login[32] == "普通护照":
            browser.find_element_by_xpath(
                "/html/body/div[16]/div[1]/div[1]/ul/li[5]/span").click()
        elif list_login[32] == "港澳同胞回乡证（通行卡）":
            browser.find_element_by_xpath(
                "/html/body/div[16]/div[1]/div[1]/ul/li[6]/span").click()
        elif list_login[32] == "台湾居民定居证":
            browser.find_element_by_xpath(
                "/html/body/div[16]/div[1]/div[1]/ul/li[7]/span").click()
        #证件号码：
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[2]/div[3]/div/div[2]/span/div[2]/input").send_keys(int(list_login[33]))
        #证件有效期
        if  list_login[34] == '长期':
            browser.find_element_by_xpath(
                "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[2]/div[4]/div/div[2]/div[1]/label[1]/span[1]/span").click()
        else:
            browser.find_element_by_xpath(
                "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[2]/div[4]/div/div[2]/div/label[2]/span[1]/span").click()
            browser.find_element_by_xpath(
                "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[2]/div[4]/div/div[2]/span/div[2]/input").send_keys(list_login[34])
        #联系电话
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[3]/div[1]/div/div[2]/span/div[2]/input").send_keys(int(list_login[35]))
        #邮箱
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[3]/div[2]/div/div[2]/span/div[2]/input").send_keys(list_login[36])
        #详细地址，邮编
        browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[4]/div[1]/div/div[2]/span[1]/span/span/span").click()
        time.sleep(1)
        browser.find_element_by_xpath('/html/body/div[18]/ul[1]/li[' + str(list_login[37]) + ']').click()
        time.sleep(1)
        browser.find_element_by_xpath('/html/body/div[18]/ul[2]/li[' + str(list_login[38]) + ']').click()
        time.sleep(1)
        browser.find_element_by_xpath('/html/body/div[18]/ul[3]/li[' + str(list_login[39]) + ']').click()

        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[4]/div[1]/div/div[2]/span[2]/div[2]/input").send_keys(list_login[40])
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[4]/div[1]/div/div[2]/span[3]/div[2]/input").send_keys(int(list_login[41]))
        #单位详细地址，邮编
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[4]/div[2]/div/div[2]/span/span/span").click()
        time.sleep(1)
        browser.find_element_by_xpath('/html/body/div[19]/ul[1]/li[' + str(list_login[42]) + ']').click()
        time.sleep(1)
        browser.find_element_by_xpath('/html/body/div[19]/ul[2]/li[' + str(list_login[43]) + ']').click()
        time.sleep(1)
        browser.find_element_by_xpath('/html/body/div[19]/ul[3]/li[' + str(list_login[44]) + ']').click()

        browser.find_element_by_xpath(
             "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[4]/div[2]/div/div[2]/div[1]/input").send_keys(list_login[45])
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[4]/div[2]/div/div[2]/div[2]/input").send_keys(int(list_login[46]))
        #职业名称
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[5]/div[2]/div/div[2]/span/div[2]/div/input").send_keys(list_login[47])
        time.sleep(1)
        browser.find_element_by_xpath("/html/body/div[20]/div[1]/div[1]/ul/li/span").click()
        #年收入
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[5]/div[4]/div/div[2]/span/div[2]/input").send_keys(int(list_login[48]))
        # 学历
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[7]/div[1]/div/div[2]/span/div[2]/div/input").click()
        time.sleep(1)
        if list_login[49] == "博士":
            browser.find_element_by_xpath("/html/body/div[21]/div[1]/div[1]/ul/li[1]").click()
        elif list_login[49] == "硕士":
            browser.find_element_by_xpath("/html/body/div[21]/div[1]/div[1]/ul/li[2]").click()
        elif list_login[49] == "本科":
            browser.find_element_by_xpath("/html/body/div[21]/div[1]/div[1]/ul/li[3]").click()
        elif list_login[49] == "大专":
            browser.find_element_by_xpath("/html/body/div[21]/div[1]/div[1]/ul/li[4]").click()
        elif list_login[49] == "中专":
            browser.find_element_by_xpath("/html/body/div[21]/div[1]/div[1]/ul/li[5]").click()
        elif list_login[49] == "中技":
            browser.find_element_by_xpath("/html/body/div[21]/div[1]/div[1]/ul/li[6]").click()
        elif list_login[49] == "初中":
            browser.find_element_by_xpath("/html/body/div[21]/div[1]/div[1]/ul/li[7]").click()
        elif list_login[49] == "小学":
            browser.find_element_by_xpath("/html/body/div[21]/div[1]/div[1]/ul/li[8]").click()
        else:
            browser.find_element_by_xpath("/html/body/div[21]/div[1]/div[1]/ul/li[9]").click()
        #单位名称
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[2]/div[7]/div[2]/div/div[2]/span/div[2]/input").send_keys(list_login[50])

    #投保人信息录入
    if list_login[25] == '本人':
        browser.find_element_by_xpath\
            ("//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[1]/div/div/div[2]/div/label[1]/span[1]/span").click()
    elif list_login[25] == '配偶':
        browser.find_element_by_xpath\
            ("//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[1]/div/div/div[2]/div/label[2]/span[1]/span").click()
        insured_person()
    elif list_login[25] == '父母':
        browser.find_element_by_xpath\
            ("//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[1]/div/div/div[2]/div/label[3]/span[1]/span").click()
        insured_person()
    elif list_login[25] == '子女':
        browser.find_element_by_xpath\
            ("//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[1]/div/div/div[2]/div/label[4]/span[1]/span").click()
        insured_person()
    elif list_login[25] == '祖父母、外祖父母':
        browser.find_element_by_xpath\
            ("//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[1]/div/div/div[2]/div/label[5]/span[1]/span").click()
        insured_person()
    elif list_login[25] == '其他':
        browser.find_element_by_xpath\
            ("//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[1]/div/div/div[2]/div/label[6]/span[1]/span").click()
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div/div/div[2]/div[1]/div/div/div[2]/div[2]/input").send_keys(list_login[26])
        insured_person()
    else:
        print('其他')
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[3]/div[2]/div/div/div/div[2]/div[1]/div[1]/input").click()

    #保单通讯地址
    time.sleep(1)
    if list_login[51] == '同投保人家庭地址':
        browser.find_element_by_xpath\
            ("/html/body/div[22]/div[1]/div[1]/ul/li[1]/span").click()
    elif list_login[51] == '同被保人家庭地址':
        browser.find_element_by_xpath\
            ("/html/body/div[22]/div[1]/div[1]/ul/li[2]/span").click()
    elif list_login[51] == '同投保人工作地址':
        browser.find_element_by_xpath\
            ("/html/body/div[22]/div[1]/div[1]/ul/li[3]/span").click()
    elif list_login[51] == '同被保人工作地址':
        browser.find_element_by_xpath\
            ("/html/body/div[22]/div[1]/div[1]/ul/li[4]/span").click()
    else:
        print('其他')
    jsgundong="document.documentElement.scrollTop=10000"
    browser.execute_script(jsgundong)
    time.sleep(2)
    browser.find_element_by_xpath("/html/body/div[1]/div/div[3]/div[4]/button[1]/span").click()

    ###################################################产品信息##################################################
    #签单时间
    windows = browser.window_handles
    browser.switch_to.window(windows[-1])

    #browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div[3]/div/div[3]/table/tbody/tr/td[1]/div/div/div[2]/span/div[2]/input").send_keys('10000796')
    time.sleep(2)
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div[1]/span[3]/div[2]/input").click()
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div[1]/span[3]/div[2]/input").send_keys(list_login[52])
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div[1]/span[5]/div[2]/input").click()
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[1]/div[1]/span[5]/div[2]/input").send_keys(list_login[53])
    #业务员工号
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[1]/div[3]/div/div[3]/table/tbody/tr/td[1]/div/div/div[2]/span/div[2]/input").clear()
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[1]/div[3]/div/div[3]/table/tbody/tr/td[1]/div/div/div[2]/span/div[2]/input").send_keys(list_login[54])

    ActionChains(browser).move_by_offset(200, 100).click().perform()
    time.sleep(2)
    #添加投保计划
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[2]/div[1]/span[2]").click()
    time.sleep(2)
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr/td[1]/div/div/div[2]/span/div[2]/div[1]/input").click()
    # js='document.getElementsByClassName("el-input__inner")[63].removeAttribute("readonly")'
    # browser.execute_script(js)
    time.sleep(1)
    if list_login[25] =='本人':
        browser.find_element_by_xpath \
            ("/html/body/div[4]/div[1]/div[1]/ul/li[1]").click()
    else:
        browser.find_element_by_xpath\
            ("/html/body/div[4]/div[1]/div[1]/ul/li[2]").click()
    #险种信息
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr/td[2]/div/div/div[2]/span/div[2]/div/input").click()
    time.sleep(4)
    if list_login[56] == '(AA01)意外伤害保险(身故保险金)':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[1]/span").click()
    elif list_login[56] =='(MI01)富卫创守护重大疾病':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[2]/span").click()
    elif list_login[56] == '(AS01)富卫世纪英才教育年金保险':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[3]/span").click()
    elif list_login[56] == '(LW03)富卫隽天壹号终身寿险':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[4]/span").click()
    elif list_login[56] == '(LW04)富卫隽天壹号终身寿险':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[5]/span").click()
    elif list_login[56] == '(LW05)富卫富贵添福终身寿险':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[6]/span").click()
    elif list_login[56] == '(LW06)富卫富贵添福终身寿险':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[7]/span").click()
    elif list_login[56] == '(MI02)富卫创守护重大疾病保险':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[8]/span").click()
    elif list_login[56] == '(AS02)富卫稳赢传富年金保险':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[9]/span").click()
    elif list_login[56] == '(AS03)富卫稳赢传富年金保险':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[10]/span").click()
    elif list_login[56] == '(LE01)富卫途行天下A款两全保险':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[11]/span").click()
    elif list_login[56] == '(LE02)富卫途行天下B款两全保险':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[12]/span").click()
    elif list_login[56] == '(AA02)富卫意外伤害保险':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[13]/span").click()
    elif list_login[56] == '(MI03)富卫创守护重大疾病保险':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[14]/span").click()
    elif list_login[56] == '(MI04)富卫创守护重大疾病保险':
        browser.find_element_by_xpath \
            ("/html/body/div[5]/div[1]/div[1]/ul/li[15]/span").click()

    #保额
    browser.find_element_by_xpath \
        ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[1]/div[3]/table/tbody/tr/td[3]/div/div/div[2]/span/div[2]/input").send_keys(list_login[57])
    browser.execute_script(jsgundong)
    time.sleep(1)
    #付费方式
    if list_login[58] == '趸缴':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[1]/div/label/span[1]/span").click()
        time.sleep(1)
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[1]/div/label/span[1]/span").click()
    elif list_login[58] == '年缴':
        time.sleep(1)
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[1]/div/label[1]/span[1]/span").click()
        time.sleep(1)
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[1]/div/label[1]/span[1]/span").click()
    elif list_login[58] == '半年缴':
        time.sleep(2)
        browser.find_element_by_xpath \
            ("/html/body/div[1]/div/div[3]/div[2]/div[2]/div[3]/div/div[1]/div/label[2]/span[1]/span").click()
        time.sleep(1)
        browser.find_element_by_xpath \
            ("/html/body/div[1]/div/div[3]/div[2]/div[2]/div[3]/div/div[1]/div/label[2]/span[1]/span").click()
        time.sleep(1)
    elif list_login[58] == '季缴':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[1]/div/label[3]/span[1]/span").click()
        time.sleep(2)
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[1]/div/label[3]/span[1]/span").click()
    elif list_login[58] == '月缴':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[1]/div/label[4]/span[1]/span").click()
        time.sleep(1)
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[1]/div/label[4]/span[1]/span").click()
    #续保超过宽限期
    time.sleep(2)
    if list_login[59] == '自动垫缴':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[2]/div/label[1]/span[1]/span").click()
    elif list_login[59] =='中止合同':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[2]/div/label[2]/span[1]/span").click()
    else:
        print("非该类型")
    #年金领取方式
    time.sleep(1)
    if list_login[60] == '现金领取':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[3]/div[1]/div/label[1]/span[1]/span").click()
    elif list_login[60] =='累计生息':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[3]/div[1]/div/label[2]/span[1]/span").click()
    elif list_login[60] =='抵交保费':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[3]/div[1]/div/label[3]/span[1]/span").click()
    else:
        print("非该类型")
    #红利领取方式
    time.sleep(1)
    if list_login[61] == '现金领取':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[3]/div[2]/div/label[1]/span[1]/span").click()
    elif list_login[61] =='累计生息':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[3]/div[2]/div/label[2]/span[1]/span").click()
    elif list_login[61] =='抵交保费':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[3]/div[2]/div/label[3]/span[1]/span").click()
    else:
        print("非该类型")
    #生存金领取方式
    time.sleep(1)
    if list_login[62] == '现金领取':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[3]/div[3]/div/label[1]/span[1]/span").click()
    elif list_login[62] =='累计生息':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[3]/div[3]/div/label[2]/span[1]/span").click()
    elif list_login[62] =='抵交保费':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[2]/div[2]/div[3]/div/div[3]/div[3]/div/label[3]/span[1]/span").click()
    else:
        print("非该类型")

    #身故受益人
    if list_login[63] =='法定':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[3]/div[2]/div/label[1]/span[1]/span").click()
    elif list_login[63] =='指定':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[3]/div[2]/div/label[2]/span[1]/span").click()
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[3]/div[1]/span[2]/i").click()
        time.sleep(1)
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[1]/div/div/div[2]/span/div[2]/input").send_keys(list_login[64])
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[2]/div/div/div[2]/span/div[2]/div/input").click()
        time.sleep(1)
        if list_login[65] =="男":
            browser.find_element_by_xpath \
                  ("/html/body/div[6]/div[1]/div[1]/ul/li[2]/span").click()
        elif list_login[65] =="女":
            browser.find_element_by_xpath \
                  ("/html/body/div[6]/div[1]/div[1]/ul/li[1]/span").click()
         #证件类型
        browser.find_element_by_xpath(
            "//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[3]/div/div/div[2]/span/div[2]/div/input").click()
        time.sleep(1)
        if list_login[66] == "居民身份证":
            browser.find_element_by_xpath(
                "/html/body/div[7]/div[1]/div[1]/ul/li[1]/span").click()
        elif list_login[66] == "户口簿":
                browser.find_element_by_xpath(
                    "/html/body/div[7]/div[1]/div[1]/ul/li[2]/span").click()
        elif list_login[66] == "中国人民解放军军官证":
                browser.find_element_by_xpath(
                    "/html/body/div[7]/div[1]/div[1]/ul/li[3]/span").click()
        elif list_login[66] == "出生医学证明":
                browser.find_element_by_xpath(
                    "/html/body/div[7]/div[1]/div[1]/ul/li[4]/span").click()
        elif list_login[66] == "普通护照":
                browser.find_element_by_xpath(
                    "/html/body/div[7]/div[1]/div[1]/ul/li[5]/span").click()
        elif list_login[66] == "港澳同胞回乡证（通行卡）":
                browser.find_element_by_xpath(
                    "/html/body/div[7]/div[1]/div[1]/ul/li[6]/span").click()
        elif list_login[66] == "台湾居民定居证":
                browser.find_element_by_xpath(
                    "/html/body/div[7]/div[1]/div[1]/ul/li[7]/span").click()
    elif list_login[63] =='信托':
        browser.find_element_by_xpath \
            ("//*[@id='app']/div/div[3]/div[3]/div[2]/div/label[3]/span[1]/span").click()
    #证件号码
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[4]/div/div/div[2]/span/div[2]/input").send_keys(list_login[67])
    #出生日期
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[5]/div/div/div[2]/span/div[2]/input").click()
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[5]/div/div/div[2]/span/div[2]/input").send_keys(list_login[68])
    #与被保险人关系
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[6]/div/div/div[2]/span/div[2]/div/input").click()
    time.sleep(1)
    if list_login[69] == "本人":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[1]/span").click()
    elif list_login[69]  =="配偶":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[2]/span").click()
    elif list_login[69] == "父母":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[3]/span").click()
    elif list_login[69] == "子女":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[4]/span").click()
    elif list_login[69]  =="兄弟姐妹":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[5]/span").click()
    elif list_login[69] == "雇主":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[6]/span").click()
    elif list_login[69]  =="雇员":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[7]/span").click()
    elif list_login[69] == "祖父母、外祖父母":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[8]/span").click()
    elif list_login[69]  =="祖孙、外祖孙":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[9]/span").click()
    elif list_login[69] == "监护人":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[10]/span").click()
    elif list_login[69] == "被监护人":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[11]/span").click()
    elif list_login[69] == "朋友":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[12]/span").click()
    elif list_login[69] == "未知":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[13]/span").click()
    elif list_login[69] == "其他":
        browser.find_element_by_xpath("/html/body/div[9]/div[1]/div[1]/ul/li[14]/span").click()

    #收益顺序
    if list_login[70] == "第一受益人":
        browser.find_element_by_xpath\
            ("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[7]/div/div/div[2]/span/div[2]/div/input").click()
        time.sleep(1)
        browser.find_element_by_xpath("/html/body/div[10]/div[1]/div[1]/ul/li[1]/span").click()
    else:
        print('其他')
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[3]/div[3]/div/div[3]/table/tbody/tr/td[8]/div/div/div[2]/span/div[2]/input").send_keys("100")
    browser.find_element_by_xpath("//*[@id='app']/div/div[3]/div[4]/div[1]/span[2]/i").click()

    #持卡人姓名
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[4]/div[2]/div/div[3]/table/tbody/tr/td[1]/div/div/div[2]/span/div[2]/div/input").click()
    time.sleep(1)
    browser.find_element_by_xpath\
        ("/html/body/div[11]/div[1]/div[1]/ul/li[1]/span").click()

    #卡用途
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[4]/div[2]/div/div[3]/table/tbody/tr/td[2]/div/div/div[2]/span/div[2]/div[2]/input").click()
    time.sleep(1)
    browser.find_element_by_xpath\
        ("/html/body/div[12]/div[1]/div[1]/ul/li[1]/span").click()
    browser.find_element_by_xpath\
        ("/html/body/div[12]/div[1]/div[1]/ul/li[2]/span").click()
    browser.find_element_by_xpath\
        ("/html/body/div[12]/div[1]/div[1]/ul/li[3]/span").click()
    #账号
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[4]/div[2]/div/div[3]/table/tbody/tr/td[3]/div/div/div[2]/span/div[2]/input").send_keys(list_login[74])
    #开户行
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[4]/div[2]/div/div[3]/table/tbody/tr/td[4]/div/div/div[2]/span/div[2]/div/input").click()
    time.sleep(1)
    browser.find_element_by_xpath\
        ('/html/body/div[13]/div[1]/div[1]/ul/li['+ str(list_login[75]) + ']/span').click()
    ################################################下一步到其他信息页面#########################################
    time.sleep(2)
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[5]/button[2]").click()
    time.sleep(2)
    #其他信息
    #本人申明
    browser.find_element_by_xpath\
        ("//*[@id='pane-1']/div/div[7]/div/div/div/div[1]/input").click()
    time.sleep(1)
    browser.find_element_by_xpath\
        ("/html/body/div[2]/div[1]/div[1]/ul/li[1]/span").click()
    #身高、体重
    browser.find_element_by_xpath\
        ("//*[@id='tab-2']").click()
    time.sleep(1)
    browser.find_element_by_xpath\
        ("//*[@id='pane-2']/div/div[2]/div/div/div/input").send_keys(list_login[84])
    browser.find_element_by_xpath\
        ("//*[@id='pane-2']/div/div[3]/div/div/div/input").send_keys(list_login[85])

    #已提供材料清单信息
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[2]/div[2]/div/div[3]/table/tbody/tr/td[2]/div/div/div/div/div/input").click()
    time.sleep(3)
    browser.find_element_by_xpath\
        ("/html/body/div[3]/div[1]/div[1]/ul/li[1]").click()

    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[2]/div[2]/div/div[3]/table/tbody/tr/td[3]/div/div/div[1]/input").click()
    time.sleep(3)
    browser.find_element_by_xpath\
        ("/html/body/div[4]/div[1]/div[1]/ul/li[1]").click()
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[2]/div[2]/div/div[3]/table/tbody/tr/td[5]/div/div/input").click()
    time.sleep(1)
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[2]/div[2]/div/div[3]/table/tbody/tr/td[5]/div/div/input").send_keys(list_login[88])
    browser.find_element_by_xpath\
        ("//*[@id='app']/div/div[3]/div[3]/button[2]").click()

    time.sleep(2)
    browser.find_element_by_xpath\
        ("/html/body/div[6]/div/div[3]/button/span").click()

    # 切换到当前窗口
    windows = browser.window_handles
    browser.switch_to.window(windows[-1])





